XAML SwapChainPanel DirectX interop sample


XAML
User Interface
Windows RT
en-US
11/25/2013

This sample demonstrates how to use the SwapChainPanel control to include Microsoft DirectX content in your Windows Store app using C++, C#, or Visual Basic app. This sample uses both Visual C++ component extensions (C++/CX), C#, and Extensible Application Markup Language (XAML).

This sample show how to:

  • Compose scenes with mixed DirectX and XAML content.
  • Implement multithreaded rendering and input handling on a background thread.
  • Change swap chain sizes in response to scale-change events.
  • Use transparent swap chains and CompositeMode to create a highlighting effect.

The sample demonstrates these tasks:

  1. Composition with XAML elements

    This scenario shows how to rotate a SwapChainPanel showing Microsoft Direct3D content, set its transparency, and compose it with other XAML elements.

  2. Handle input, render ink strokes, and recognize handwriting

    This scenario shows how to handle input, render ink strokes, and recognize handwriting using Direct2D on a background thread.

  3. Scale DirectX content smoothly and precisely

    This scenario shows how to scale DirectX content in a ScrollViewer control.

  4. Use a transparent swap chain

    This scenario shows how to use SwapChainPanel for transparent swap chains. A transparent swap chain is placed over XAML text, and the panel's CompositeMode is set to ElementCompositeMode.MinBlend, to enable a highlighter effect.

  5. Add accessibility support for DirectX content

    This scenario shows how to add UI Automation (UIA) accessibility support for DirectX content by creating accessibility peers.

To obtain an evaluation copy of Windows 8.1, go to Windows 8.1.

To obtain an evaluation copy of Microsoft Visual Studio 2013, go to Visual Studio 2013.

Related topics

Roadmaps
Roadmap for C# and Visual Basic
Samples
Windows app samples
Reference
SwapChainPanel
CompositeMode

Operating system requirements

Client
Windows 8.1
Server
Windows Server 2012 R2

Build the sample

  1. Start Visual Studio 2013 and select File > Open > Project/Solution.
  2. Go to the directory in which you unzipped the sample. Go to the directory named for the sample, and double-click the Visual Studio 2013 Solution (.sln) file.
  3. Press F7 or use Build > Build Solution to build the sample.

Run the sample

To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.